<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>后台管理</title>
    <link rel="stylesheet" type="text/css" href="/resources/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="/resources/easyui/themes/icon.css">
    <script type="text/javascript" src="/resources/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="/resources/easyui/jquery.easyui.min.js"></script>
</head>
<body>
<table class="easyui-datagrid" title="后台管理" style="height:300px"
       data-options="rownumbers:true,singleSelect:true,url:'/buyspage?userid=${userid}',method:'get',toolbar:toolbar,pagination:true">
    <thead>
    <tr>
        <th data-options="field:'goodsname',width:200,halign:'center'">商品名称</th>
        <th data-options="field:'money',width:100,align:'right',halign:'center'">金额</th>
        <th data-options="field:'paydate',width:150,align:'center',halign:'center'">付款日期</th>
    </tr>
    </thead>
</table>
<script type="text/javascript">
    var toolbar = [{
        text: '增加 ',
        iconCls: 'icon-add',
        handler: function () {
            window.open("/buysdetail?userid=${userid}")
        }
    }, {
        text: '删除',
        iconCls: 'icon-cut',
        handler: function () {
            var selected = $(".easyui-datagrid").datagrid("getSelected");
            if (null != selected) {
                if (confirm("确定删除选中项吗？")) {
                    $.post("/buysdelete", {
                        id: selected.id
                    }, function () {
                        $(".easyui-datagrid").datagrid("reload");
                    });
                }
            } else {
                alert("请选择项");
            }
        }
    }];
    function onDblClickRow(index, row) {
        window.open("/detail?id=" + row.id);
    }
    function op() {
        var htm = '';
        htm += '<a href="/buys" target="_blank">购买记录</a>';
        return htm;
    }
</script>
</body>
</html>